<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <p @click="reverseMessage">
            {{message}}
        </p>
        <!-- <input type="text"v-bind:value="value"@input="inputHandler"> -->
        <input type="text"v-model="value">
        <p v-bind:title="message">{{value}}</p>

        <xxx-yyy name="nick"age="18"></xxx-yyy>
        <xxx-yyy name="amy"></xxx-yyy>
        <xxx-yyy></xxx-yyy>
        <!-- 自定义html标签 -->
    </div>
    <script>
        Vue.component("xxx-yyy",{
            //vue组件本质就是   类似根组件的vue实例对象
            // data:{
            //     xx:'231',
            // },
            props:["name"],
            template:"<h2><i>xxx--{{name}}</i></h2>"
        });
        //组件没有el属性，有template 显示

        //根组件
        new Vue({
            el:"#app",
            data:{
                message:"Hello Vue.js!",
                value:"hello"
            },
            methods: {
                reverseMessage:function(){
                    this.message=this.message.split(" ").reverse().join(" ");
                },
                // inputHandler:function(e){
                //     // console.log(e.target.value);
                //     this.value=e.target.value;
                // }
            },
        })
        
    </script>
</body>
</html>
<!-- 
    v-if
    v-for
    v-bind=>:
    v-on=>@
    v-model
 -->